import 'package:flutter/material.dart';
import 'package:flutter_ability/custom_ui.dart';
import 'package:flutter_ability_example/data_display/accordion_page.dart';
import 'package:flutter_ability_example/data_display/avatar_page.dart';
import 'package:flutter_ability_example/data_display/badge_page.dart';
import 'package:flutter_ability_example/data_display/carousel_page.dart';
import 'package:flutter_ability_example/data_display/empty_img_page.dart';
import 'package:flutter_ability_example/data_display/image_custom_page.dart';
import 'package:flutter_ability_example/data_display/image_img_page.dart';
import 'package:flutter_ability_example/data_display/list/list_page.dart';
import 'package:flutter_ability_example/data_display/list/list_page3.dart';
import 'package:flutter_ability_example/utils/color_utils.dart';

class DataDisplayPage extends StatefulWidget {
  const DataDisplayPage({Key? key}) : super(key: key);

  @override
  State<DataDisplayPage> createState() => _DataDisplayPageState();
}

class _DataDisplayPageState extends State<DataDisplayPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("数据展示"),
      ),
      body: Container(
        padding: const EdgeInsets.only(left: 16, right: 16),
        child: buildCenter(context),
      ),
    );
  }

  buildCenter(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const ListPage();
            }));
          },
          text: "List 单行列表",
          color: YJColors.NOTICE,
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const ListPage3();
            }));
          },
          text: "List 多行列表",
          color: YJColors.INFOLINK,
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const AccordionPage();
            }));
          },
          text: "折叠面板",
          color: ColorUtils.getRandomColor(),
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const BadgePage();
            }));
          },
          text: "Badge 微标",
          color: ColorUtils.getRandomColor(),
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const ImageImgPage();
            }));
          },
          text: "Image 图片",
          color: ColorUtils.getRandomColor(),
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const EmptyImgPage();
            }));
          },
          text: "Empty 缺省插图",
          color: ColorUtils.getRandomColor(),
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const ImageCustomPage();
            }));
          },
          text: "Image 自定义",
          color: ColorUtils.getRandomColor(),
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const AvatarPage();
            }));
          },
          text: "Image 头像",
          color: ColorUtils.getRandomColor(),
          textColor: Colors.white,
        ),
        YJButton(
          onPressed: () {
            Navigator.of(context).push(MaterialPageRoute(builder: (ctx) {
              return const CarouselPage();
            }));
          },
          text: "轮播图",
          color: ColorUtils.getRandomColor(),
          textColor: Colors.white,
        ),
      ],
    );
  }
}
